const HomeModules: Record<string, unknown> = {
    state: {
        navBool: false,
        dialogFormVisible: false,
        uplistData: {},
        // 用户token信息-csj
        _token: window.localStorage.getItem("_token") ? window.localStorage.getItem("_token") : "",
        // 用户userId-csj
        userId: window.localStorage.getItem("userId") ? window.localStorage.getItem("userId") : ""

    },
    getters: {
    },
    mutations: {
        // 修改state的数据
        SET_NAVBOOL(state: any) {
            state.navBool = !state.navBool
        },
        // 打开弹窗或者关闭弹窗
        SET_DIALOG(state: any, paylog: any) {
            state.dialogFormVisible = !state.dialogFormVisible
            state.uplistData = paylog
        },
        // 弹窗的确定或取消按钮操作
        DIALOG(state: any) {
            state.dialogFormVisible = !state.dialogFormVisible
            location.reload()
        },
        // 更新 token 信息-csj
        updateToken(state: any, _token: any) {
            console.log('vuex', state, _token);
            localStorage.setItem("_token", _token);
            state._token = _token;
        },
        // 更新 userId 信息-csj
        updateUserId(state: any, id: any) {
            localStorage.setItem("userId", id);
            state.userId = id;
        },
        // 用户退出-csj
        userLogout(state: any) {
            state._token = ''
            state.userId = ''
            localStorage.clear()
            
        }
    }, 
    actions: {
    },
}
export default HomeModules;